package com.yingxin.yxerp.module.message.vo.resp;

import com.yingxin.yx.framework.commons.constant.CommonConst;
import com.yingxin.yx.framework.commons.vo.CommonRespVo;
import com.yingxin.yxerp.module.common.BusinessTypeHelper;
import com.yingxin.yxerp.module.message.constant.UserMsgTypeHelper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 用户消息
 * @author fanchao
 * @since 2022-03-22
 */

@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "UserMessageRespVo对象", description = "用户消息")
public class UserMessageRespVo extends CommonRespVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id ")
    private String id;

    @ApiModelProperty(value = "接收人 id")
    private String receiverId;

    @ApiModelProperty(value = "发送人 id")
    private String senderId;

    @ApiModelProperty(value = "业务 id ")
    private String businessId;

    @ApiModelProperty(value = "业务类型")
    private String businessType;

    @ApiModelProperty(value = "业务编号 ")
    private String businessNo;

    @ApiModelProperty(value = "当前流程实例id")
    private String processInstanceId;

    @ApiModelProperty(value = "task id")
    private String taskId;

    @ApiModelProperty(value = "消息类型")
    private String messageType;

    @ApiModelProperty(value = "消息内容")
    private String messageContent;

    @ApiModelProperty(value = "已读标记：0 未读 1 已读")
    private String readFlag;

    //@ApiModelProperty(value = "消息查看时间")
    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    //private Date readTime;

    //
    @ApiModelProperty(value = "发送人名称")
    private String senderName;

    @ApiModelProperty(value = "接收人名称")
    private String receiverName;


    public String getMessageTypeName() {
        return UserMsgTypeHelper.getName(messageType);
    }

    public String getBusinessTypeName(){return BusinessTypeHelper.getName(businessType);}

    public String getBillId() {
        return businessId;
    }

    public String getBillNo() {
        return businessNo;
    }

    public String getBillType() {
        return businessType;
    }

    public String getBillTypeName() {
        return BusinessTypeHelper.getName(businessType);
    }

    public String getReadFlagName() {
        return CommonConst.TRUE.equals(readFlag) ? "已读" : "未读";
    }

}
